<?php

class DB_ERP_ZHUANFA extends ORM_Table{
    
    static protected $store_zhuanfa = array();
    static protected $table_name = 'erp_zhuanfa';
    
    static public function getTableName($params = null) {
        return self::$table_name;
    }
    
    static function store_zhuanfa($v){
        $rs = ORM_Finder::findOne('DB_ERP_ZHUANFA', array('mid'=>$v['mid']));
        if(!$rs){
            $rs = new DB_ERP_ZHUANFA();
            $rs->setUserId($v['user']['id']);
            $rs->setMid($v['mid']);
            $rs->setBlogId($v['retweeted_status']['mid']);
            $rs->setText($v['text']);
            $rs->setSource($v['source']);
            $rs->setCreatedAt(date('Y-m-d H:i:s', strtotime($v['created_at'])));
        }
        $rs->setUser(serialize($v['user']));
        $rs->save();
        return $rs->toArray();
    }
    
}
?>
